// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate iam_v1;
extern crate lazy_static;
extern crate location;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// AddressGroup is a resource that specifies how a collection of IP/DNS used
/// in Firewall Policy.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddressGroup {
    /// Required. Name of the AddressGroup resource. It matches pattern
    /// `projects/*/locations/{location}/addressGroups/<address_group>`.
    pub name: std::string::String,

    /// Optional. Free-text description of the resource.
    pub description: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Set of label tags associated with the AddressGroup resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. The type of the Address Group. Possible values are "IPv4" or
    /// "IPV6".
    pub r#type: crate::model::address_group::Type,

    /// Optional. List of items.
    pub items: std::vec::Vec<std::string::String>,

    /// Required. Capacity of the Address Group
    pub capacity: i32,

    /// Output only. Server-defined fully-qualified URL for this resource.
    pub self_link: std::string::String,

    /// Optional. List of supported purposes of the Address Group.
    pub purpose: std::vec::Vec<crate::model::address_group::Purpose>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AddressGroup {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::AddressGroup::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::AddressGroup::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::AddressGroup::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::AddressGroup::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::AddressGroup::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::AddressGroup::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::AddressGroup::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [r#type][crate::model::AddressGroup::type].
    pub fn set_type<T: std::convert::Into<crate::model::address_group::Type>>(
        mut self,
        v: T,
    ) -> Self {
        self.r#type = v.into();
        self
    }

    /// Sets the value of [items][crate::model::AddressGroup::items].
    pub fn set_items<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.items = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [capacity][crate::model::AddressGroup::capacity].
    pub fn set_capacity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.capacity = v.into();
        self
    }

    /// Sets the value of [self_link][crate::model::AddressGroup::self_link].
    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.self_link = v.into();
        self
    }

    /// Sets the value of [purpose][crate::model::AddressGroup::purpose].
    pub fn set_purpose<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::address_group::Purpose>,
    {
        use std::iter::Iterator;
        self.purpose = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for AddressGroup {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.AddressGroup"
    }
}

/// Defines additional types related to [AddressGroup].
pub mod address_group {
    #[allow(unused_imports)]
    use super::*;

    /// Possible type of the Address Group.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Type {
        /// Default value.
        Unspecified,
        /// IP v4 ranges.
        Ipv4,
        /// IP v6 ranges.
        Ipv6,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Type::value] or
        /// [Type::name].
        UnknownValue(r#type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod r#type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Type {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Ipv4 => std::option::Option::Some(1),
                Self::Ipv6 => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
                Self::Ipv4 => std::option::Option::Some("IPV4"),
                Self::Ipv6 => std::option::Option::Some("IPV6"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Type {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Type {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Type {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Ipv4,
                2 => Self::Ipv6,
                _ => Self::UnknownValue(r#type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Type {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "TYPE_UNSPECIFIED" => Self::Unspecified,
                "IPV4" => Self::Ipv4,
                "IPV6" => Self::Ipv6,
                _ => Self::UnknownValue(r#type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Type {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Ipv4 => serializer.serialize_i32(1),
                Self::Ipv6 => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Type {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
                ".google.cloud.networksecurity.v1.AddressGroup.Type",
            ))
        }
    }

    /// Purpose of the Address Group.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Purpose {
        /// Default value. Should never happen.
        Unspecified,
        /// Address Group is distributed to VMC, and is usable in Firewall Policies
        /// and other systems that rely on VMC.
        Default,
        /// Address Group is usable in Cloud Armor.
        CloudArmor,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Purpose::value] or
        /// [Purpose::name].
        UnknownValue(purpose::UnknownValue),
    }

    #[doc(hidden)]
    pub mod purpose {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Purpose {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Default => std::option::Option::Some(1),
                Self::CloudArmor => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("PURPOSE_UNSPECIFIED"),
                Self::Default => std::option::Option::Some("DEFAULT"),
                Self::CloudArmor => std::option::Option::Some("CLOUD_ARMOR"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Purpose {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Purpose {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Purpose {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Default,
                2 => Self::CloudArmor,
                _ => Self::UnknownValue(purpose::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Purpose {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "PURPOSE_UNSPECIFIED" => Self::Unspecified,
                "DEFAULT" => Self::Default,
                "CLOUD_ARMOR" => Self::CloudArmor,
                _ => Self::UnknownValue(purpose::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Purpose {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Default => serializer.serialize_i32(1),
                Self::CloudArmor => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Purpose {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Purpose>::new(
                ".google.cloud.networksecurity.v1.AddressGroup.Purpose",
            ))
        }
    }
}

/// Request used with the ListAddressGroups method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAddressGroupsRequest {
    /// Required. The project and location from which the AddressGroups
    /// should be listed, specified in the format
    /// `projects/*/locations/{location}`.
    pub parent: std::string::String,

    /// Maximum number of AddressGroups to return per call.
    pub page_size: i32,

    /// The value returned by the last
    /// `ListAddressGroupsResponse` Indicates that this is a
    /// continuation of a prior `ListAddressGroups` call, and
    /// that the system should return the next page of data.
    pub page_token: std::string::String,

    /// Optional. If true, allow partial responses for multi-regional Aggregated
    /// List requests.
    pub return_partial_success: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListAddressGroupsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListAddressGroupsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListAddressGroupsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListAddressGroupsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [return_partial_success][crate::model::ListAddressGroupsRequest::return_partial_success].
    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.return_partial_success = v.into();
        self
    }
}

impl wkt::message::Message for ListAddressGroupsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupsRequest"
    }
}

/// Response returned by the ListAddressGroups method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAddressGroupsResponse {
    /// List of AddressGroups resources.
    pub address_groups: std::vec::Vec<crate::model::AddressGroup>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListAddressGroupsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [address_groups][crate::model::ListAddressGroupsResponse::address_groups].
    pub fn set_address_groups<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::AddressGroup>,
    {
        use std::iter::Iterator;
        self.address_groups = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListAddressGroupsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListAddressGroupsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListAddressGroupsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListAddressGroupsResponse {
    type PageItem = crate::model::AddressGroup;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.address_groups
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the GetAddressGroup method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetAddressGroupRequest {
    /// Required. A name of the AddressGroup to get. Must be in the format
    /// `projects/*/locations/{location}/addressGroups/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetAddressGroupRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetAddressGroupRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetAddressGroupRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.GetAddressGroupRequest"
    }
}

/// Request used by the CreateAddressGroup method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateAddressGroupRequest {
    /// Required. The parent resource of the AddressGroup. Must be in the
    /// format `projects/*/locations/{location}`.
    pub parent: std::string::String,

    /// Required. Short name of the AddressGroup resource to be created.
    /// This value should be 1-63 characters long, containing only
    /// letters, numbers, hyphens, and underscores, and should not start
    /// with a number. E.g. "authz_policy".
    pub address_group_id: std::string::String,

    /// Required. AddressGroup resource to be created.
    pub address_group: std::option::Option<crate::model::AddressGroup>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateAddressGroupRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateAddressGroupRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [address_group_id][crate::model::CreateAddressGroupRequest::address_group_id].
    pub fn set_address_group_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.address_group_id = v.into();
        self
    }

    /// Sets the value of [address_group][crate::model::CreateAddressGroupRequest::address_group].
    pub fn set_address_group<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::AddressGroup>,
    {
        self.address_group = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [address_group][crate::model::CreateAddressGroupRequest::address_group].
    pub fn set_or_clear_address_group<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::AddressGroup>,
    {
        self.address_group = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateAddressGroupRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateAddressGroupRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.CreateAddressGroupRequest"
    }
}

/// Request used by the UpdateAddressGroup method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateAddressGroupRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// AddressGroup resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated AddressGroup resource.
    pub address_group: std::option::Option<crate::model::AddressGroup>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateAddressGroupRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateAddressGroupRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateAddressGroupRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [address_group][crate::model::UpdateAddressGroupRequest::address_group].
    pub fn set_address_group<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::AddressGroup>,
    {
        self.address_group = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [address_group][crate::model::UpdateAddressGroupRequest::address_group].
    pub fn set_or_clear_address_group<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::AddressGroup>,
    {
        self.address_group = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateAddressGroupRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateAddressGroupRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.UpdateAddressGroupRequest"
    }
}

/// Request used by the DeleteAddressGroup method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteAddressGroupRequest {
    /// Required. A name of the AddressGroup to delete. Must be in the format
    /// `projects/*/locations/{location}/addressGroups/*`.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteAddressGroupRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteAddressGroupRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteAddressGroupRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeleteAddressGroupRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.DeleteAddressGroupRequest"
    }
}

/// Request used by the AddAddressGroupItems method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddAddressGroupItemsRequest {
    /// Required. A name of the AddressGroup to add items to. Must be in the format
    /// `projects|organization/*/locations/{location}/addressGroups/*`.
    pub address_group: std::string::String,

    /// Required. List of items to add.
    pub items: std::vec::Vec<std::string::String>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AddAddressGroupItemsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [address_group][crate::model::AddAddressGroupItemsRequest::address_group].
    pub fn set_address_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.address_group = v.into();
        self
    }

    /// Sets the value of [items][crate::model::AddAddressGroupItemsRequest::items].
    pub fn set_items<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.items = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [request_id][crate::model::AddAddressGroupItemsRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for AddAddressGroupItemsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.AddAddressGroupItemsRequest"
    }
}

/// Request used by the RemoveAddressGroupItems method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RemoveAddressGroupItemsRequest {
    /// Required. A name of the AddressGroup to remove items from. Must be in the
    /// format `projects|organization/*/locations/{location}/addressGroups/*`.
    pub address_group: std::string::String,

    /// Required. List of items to remove.
    pub items: std::vec::Vec<std::string::String>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RemoveAddressGroupItemsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [address_group][crate::model::RemoveAddressGroupItemsRequest::address_group].
    pub fn set_address_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.address_group = v.into();
        self
    }

    /// Sets the value of [items][crate::model::RemoveAddressGroupItemsRequest::items].
    pub fn set_items<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.items = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [request_id][crate::model::RemoveAddressGroupItemsRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for RemoveAddressGroupItemsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest"
    }
}

/// Request used by the CloneAddressGroupItems method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CloneAddressGroupItemsRequest {
    /// Required. A name of the AddressGroup to clone items to. Must be in the
    /// format `projects|organization/*/locations/{location}/addressGroups/*`.
    pub address_group: std::string::String,

    /// Required. Source address group to clone items from.
    pub source_address_group: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CloneAddressGroupItemsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [address_group][crate::model::CloneAddressGroupItemsRequest::address_group].
    pub fn set_address_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.address_group = v.into();
        self
    }

    /// Sets the value of [source_address_group][crate::model::CloneAddressGroupItemsRequest::source_address_group].
    pub fn set_source_address_group<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.source_address_group = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::CloneAddressGroupItemsRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CloneAddressGroupItemsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest"
    }
}

/// Request used by the ListAddressGroupReferences method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAddressGroupReferencesRequest {
    /// Required. A name of the AddressGroup to clone items to. Must be in the
    /// format `projects|organization/*/locations/{location}/addressGroups/*`.
    pub address_group: std::string::String,

    /// The maximum number of references to return.  If unspecified, server
    /// will pick an appropriate default. Server may return fewer items than
    /// requested. A caller should only rely on response's
    /// [next_page_token][google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token]
    /// to determine if there are more AddressGroupUsers left to be queried.
    ///
    /// [google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token]: crate::model::ListAddressGroupReferencesResponse::next_page_token
    pub page_size: i32,

    /// The next_page_token value returned from a previous List request,
    /// if any.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListAddressGroupReferencesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [address_group][crate::model::ListAddressGroupReferencesRequest::address_group].
    pub fn set_address_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.address_group = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListAddressGroupReferencesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListAddressGroupReferencesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListAddressGroupReferencesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest"
    }
}

/// Response of the ListAddressGroupReferences method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAddressGroupReferencesResponse {
    /// A list of references that matches the specified filter in the request.
    pub address_group_references:
        std::vec::Vec<crate::model::list_address_group_references_response::AddressGroupReference>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListAddressGroupReferencesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [address_group_references][crate::model::ListAddressGroupReferencesResponse::address_group_references].
    pub fn set_address_group_references<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<
                crate::model::list_address_group_references_response::AddressGroupReference,
            >,
    {
        use std::iter::Iterator;
        self.address_group_references = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListAddressGroupReferencesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListAddressGroupReferencesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListAddressGroupReferencesResponse {
    type PageItem = crate::model::list_address_group_references_response::AddressGroupReference;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.address_group_references
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Defines additional types related to [ListAddressGroupReferencesResponse].
pub mod list_address_group_references_response {
    #[allow(unused_imports)]
    use super::*;

    /// The Reference of AddressGroup.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct AddressGroupReference {
        /// FirewallPolicy that is using the Address Group.
        pub firewall_policy: std::string::String,

        /// Cloud Armor SecurityPolicy that is using the Address Group.
        pub security_policy: std::string::String,

        /// Rule priority of the FirewallPolicy that is using the Address Group.
        pub rule_priority: i32,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl AddressGroupReference {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [firewall_policy][crate::model::list_address_group_references_response::AddressGroupReference::firewall_policy].
        pub fn set_firewall_policy<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.firewall_policy = v.into();
            self
        }

        /// Sets the value of [security_policy][crate::model::list_address_group_references_response::AddressGroupReference::security_policy].
        pub fn set_security_policy<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.security_policy = v.into();
            self
        }

        /// Sets the value of [rule_priority][crate::model::list_address_group_references_response::AddressGroupReference::rule_priority].
        pub fn set_rule_priority<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.rule_priority = v.into();
            self
        }
    }

    impl wkt::message::Message for AddressGroupReference {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference"
        }
    }
}

/// AuthorizationPolicy is a resource that specifies how a server
/// should authorize incoming connections. This resource in itself does
/// not change the configuration unless it's attached to a target https
/// proxy or endpoint config selector resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AuthorizationPolicy {
    /// Required. Name of the AuthorizationPolicy resource. It matches pattern
    /// `projects/{project}/locations/{location}/authorizationPolicies/<authorization_policy>`.
    pub name: std::string::String,

    /// Optional. Free-text description of the resource.
    pub description: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Set of label tags associated with the AuthorizationPolicy resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. The action to take when a rule match is found. Possible values
    /// are "ALLOW" or "DENY".
    pub action: crate::model::authorization_policy::Action,

    /// Optional. List of rules to match. Note that at least one of the rules must match in
    /// order for the action specified in the 'action' field to be taken. A rule is
    /// a match if there is a matching source and destination. If left blank, the
    /// action specified in the `action` field will be applied on every request.
    pub rules: std::vec::Vec<crate::model::authorization_policy::Rule>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AuthorizationPolicy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::AuthorizationPolicy::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::AuthorizationPolicy::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::AuthorizationPolicy::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::AuthorizationPolicy::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::AuthorizationPolicy::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::AuthorizationPolicy::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::AuthorizationPolicy::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [action][crate::model::AuthorizationPolicy::action].
    pub fn set_action<T: std::convert::Into<crate::model::authorization_policy::Action>>(
        mut self,
        v: T,
    ) -> Self {
        self.action = v.into();
        self
    }

    /// Sets the value of [rules][crate::model::AuthorizationPolicy::rules].
    pub fn set_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::authorization_policy::Rule>,
    {
        use std::iter::Iterator;
        self.rules = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for AuthorizationPolicy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.AuthorizationPolicy"
    }
}

/// Defines additional types related to [AuthorizationPolicy].
pub mod authorization_policy {
    #[allow(unused_imports)]
    use super::*;

    /// Specification of rules.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Rule {
        /// Optional. List of attributes for the traffic source. All of the sources must match.
        /// A source is a match if both principals and ip_blocks match. If not set,
        /// the action specified in the 'action' field will be applied without any
        /// rule checks for the source.
        pub sources: std::vec::Vec<crate::model::authorization_policy::rule::Source>,

        /// Optional. List of attributes for the traffic destination. All of the destinations
        /// must match. A destination is a match if a request matches all the
        /// specified hosts, ports, methods and headers. If not set, the
        /// action specified in the 'action' field will be applied without any rule
        /// checks for the destination.
        pub destinations: std::vec::Vec<crate::model::authorization_policy::rule::Destination>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Rule {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [sources][crate::model::authorization_policy::Rule::sources].
        pub fn set_sources<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::authorization_policy::rule::Source>,
        {
            use std::iter::Iterator;
            self.sources = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [destinations][crate::model::authorization_policy::Rule::destinations].
        pub fn set_destinations<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::authorization_policy::rule::Destination>,
        {
            use std::iter::Iterator;
            self.destinations = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for Rule {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networksecurity.v1.AuthorizationPolicy.Rule"
        }
    }

    /// Defines additional types related to [Rule].
    pub mod rule {
        #[allow(unused_imports)]
        use super::*;

        /// Specification of traffic source attributes.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Source {
            /// Optional. List of peer identities to match for authorization. At least one
            /// principal should match. Each peer can be an exact match, or a prefix
            /// match (example, "namespace/*") or a suffix match (example,
            /// "*/service-account") or a presence match "*". Authorization based on
            /// the principal name without certificate validation (configured by
            /// ServerTlsPolicy resource) is considered insecure.
            pub principals: std::vec::Vec<std::string::String>,

            /// Optional. List of CIDR ranges to match based on source IP address. At least one
            /// IP block should match. Single IP (e.g., "1.2.3.4") and CIDR (e.g.,
            /// "1.2.3.0/24") are supported. Authorization based on source IP alone
            /// should be avoided. The IP addresses of any load balancers or proxies
            /// should be considered untrusted.
            pub ip_blocks: std::vec::Vec<std::string::String>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Source {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [principals][crate::model::authorization_policy::rule::Source::principals].
            pub fn set_principals<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<std::string::String>,
            {
                use std::iter::Iterator;
                self.principals = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [ip_blocks][crate::model::authorization_policy::rule::Source::ip_blocks].
            pub fn set_ip_blocks<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<std::string::String>,
            {
                use std::iter::Iterator;
                self.ip_blocks = v.into_iter().map(|i| i.into()).collect();
                self
            }
        }

        impl wkt::message::Message for Source {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.networksecurity.v1.AuthorizationPolicy.Rule.Source"
            }
        }

        /// Specification of traffic destination attributes.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Destination {
            /// Required. List of host names to match. Matched against the ":authority" header in
            /// http requests. At least one host should match. Each host can be an
            /// exact match, or a prefix match (example "mydomain.*") or a suffix
            /// match (example "*.myorg.com") or a presence (any) match "*".
            pub hosts: std::vec::Vec<std::string::String>,

            /// Required. List of destination ports to match. At least one port should match.
            pub ports: std::vec::Vec<u32>,

            /// Optional. A list of HTTP methods to match. At least one method should
            /// match. Should not be set for gRPC services.
            pub methods: std::vec::Vec<std::string::String>,

            /// Optional. Match against key:value pair in http header. Provides a flexible match
            /// based on HTTP headers, for potentially advanced use cases. At least one
            /// header should match. Avoid using header matches to make authorization
            /// decisions unless there is a strong guarantee that requests arrive
            /// through a trusted client or proxy.
            pub http_header_match: std::option::Option<
                crate::model::authorization_policy::rule::destination::HttpHeaderMatch,
            >,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Destination {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [hosts][crate::model::authorization_policy::rule::Destination::hosts].
            pub fn set_hosts<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<std::string::String>,
            {
                use std::iter::Iterator;
                self.hosts = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [ports][crate::model::authorization_policy::rule::Destination::ports].
            pub fn set_ports<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<u32>,
            {
                use std::iter::Iterator;
                self.ports = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [methods][crate::model::authorization_policy::rule::Destination::methods].
            pub fn set_methods<T, V>(mut self, v: T) -> Self
            where
                T: std::iter::IntoIterator<Item = V>,
                V: std::convert::Into<std::string::String>,
            {
                use std::iter::Iterator;
                self.methods = v.into_iter().map(|i| i.into()).collect();
                self
            }

            /// Sets the value of [http_header_match][crate::model::authorization_policy::rule::Destination::http_header_match].
            pub fn set_http_header_match<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<
                        crate::model::authorization_policy::rule::destination::HttpHeaderMatch,
                    >,
            {
                self.http_header_match = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [http_header_match][crate::model::authorization_policy::rule::Destination::http_header_match].
            pub fn set_or_clear_http_header_match<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<
                        crate::model::authorization_policy::rule::destination::HttpHeaderMatch,
                    >,
            {
                self.http_header_match = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for Destination {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.networksecurity.v1.AuthorizationPolicy.Rule.Destination"
            }
        }

        /// Defines additional types related to [Destination].
        pub mod destination {
            #[allow(unused_imports)]
            use super::*;

            /// Specification of HTTP header match attributes.
            #[derive(Clone, Default, PartialEq)]
            #[non_exhaustive]
            pub struct HttpHeaderMatch {
                /// Required. The name of the HTTP header to match. For matching
                /// against the HTTP request's authority, use a headerMatch
                /// with the header name ":authority". For matching a
                /// request's method, use the headerName ":method".
                pub header_name: std::string::String,

                pub r#type: std::option::Option<
                    crate::model::authorization_policy::rule::destination::http_header_match::Type,
                >,

                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
            }

            impl HttpHeaderMatch {
                pub fn new() -> Self {
                    std::default::Default::default()
                }

                /// Sets the value of [header_name][crate::model::authorization_policy::rule::destination::HttpHeaderMatch::header_name].
                pub fn set_header_name<T: std::convert::Into<std::string::String>>(
                    mut self,
                    v: T,
                ) -> Self {
                    self.header_name = v.into();
                    self
                }

                /// Sets the value of [r#type][crate::model::authorization_policy::rule::destination::HttpHeaderMatch::type].
                ///
                /// Note that all the setters affecting `r#type` are mutually
                /// exclusive.
                pub fn set_type<T: std::convert::Into<std::option::Option<crate::model::authorization_policy::rule::destination::http_header_match::Type>>>(mut self, v: T) -> Self
                {
                    self.r#type = v.into();
                    self
                }

                /// The value of [r#type][crate::model::authorization_policy::rule::destination::HttpHeaderMatch::r#type]
                /// if it holds a `RegexMatch`, `None` if the field is not set or
                /// holds a different branch.
                pub fn regex_match(&self) -> std::option::Option<&std::string::String> {
                    #[allow(unreachable_patterns)]
                    self.r#type.as_ref().and_then(|v| match v {
                        crate::model::authorization_policy::rule::destination::http_header_match::Type::RegexMatch(v) => std::option::Option::Some(v),
                        _ => std::option::Option::None,
                    })
                }

                /// Sets the value of [r#type][crate::model::authorization_policy::rule::destination::HttpHeaderMatch::r#type]
                /// to hold a `RegexMatch`.
                ///
                /// Note that all the setters affecting `r#type` are
                /// mutually exclusive.
                pub fn set_regex_match<T: std::convert::Into<std::string::String>>(
                    mut self,
                    v: T,
                ) -> Self {
                    self.r#type = std::option::Option::Some(
                        crate::model::authorization_policy::rule::destination::http_header_match::Type::RegexMatch(
                            v.into()
                        )
                    );
                    self
                }
            }

            impl wkt::message::Message for HttpHeaderMatch {
                fn typename() -> &'static str {
                    "type.googleapis.com/google.cloud.networksecurity.v1.AuthorizationPolicy.Rule.Destination.HttpHeaderMatch"
                }
            }

            /// Defines additional types related to [HttpHeaderMatch].
            pub mod http_header_match {
                #[allow(unused_imports)]
                use super::*;

                #[derive(Clone, Debug, PartialEq)]
                #[non_exhaustive]
                pub enum Type {
                    /// Required. The value of the header must match the regular expression
                    /// specified in regexMatch. For regular expression grammar,
                    /// please see: en.cppreference.com/w/cpp/regex/ecmascript
                    /// For matching against a port specified in the HTTP
                    /// request, use a headerMatch with headerName set to Host
                    /// and a regular expression that satisfies the RFC2616 Host
                    /// header's port specifier.
                    RegexMatch(std::string::String),
                }
            }
        }
    }

    /// Possible values that define what action to take.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Action {
        /// Default value.
        Unspecified,
        /// Grant access.
        Allow,
        /// Deny access.
        /// Deny rules should be avoided unless they are used to provide a default
        /// "deny all" fallback.
        Deny,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Action::value] or
        /// [Action::name].
        UnknownValue(action::UnknownValue),
    }

    #[doc(hidden)]
    pub mod action {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Action {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Allow => std::option::Option::Some(1),
                Self::Deny => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("ACTION_UNSPECIFIED"),
                Self::Allow => std::option::Option::Some("ALLOW"),
                Self::Deny => std::option::Option::Some("DENY"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Action {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Action {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Action {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Allow,
                2 => Self::Deny,
                _ => Self::UnknownValue(action::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Action {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ACTION_UNSPECIFIED" => Self::Unspecified,
                "ALLOW" => Self::Allow,
                "DENY" => Self::Deny,
                _ => Self::UnknownValue(action::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Action {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Allow => serializer.serialize_i32(1),
                Self::Deny => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Action {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Action>::new(
                ".google.cloud.networksecurity.v1.AuthorizationPolicy.Action",
            ))
        }
    }
}

/// Request used with the ListAuthorizationPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAuthorizationPoliciesRequest {
    /// Required. The project and location from which the AuthorizationPolicies
    /// should be listed, specified in the format
    /// `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// Maximum number of AuthorizationPolicies to return per call.
    pub page_size: i32,

    /// The value returned by the last
    /// `ListAuthorizationPoliciesResponse` Indicates that this is a
    /// continuation of a prior `ListAuthorizationPolicies` call, and
    /// that the system should return the next page of data.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListAuthorizationPoliciesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListAuthorizationPoliciesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListAuthorizationPoliciesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListAuthorizationPoliciesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListAuthorizationPoliciesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest"
    }
}

/// Response returned by the ListAuthorizationPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAuthorizationPoliciesResponse {
    /// List of AuthorizationPolicies resources.
    pub authorization_policies: std::vec::Vec<crate::model::AuthorizationPolicy>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListAuthorizationPoliciesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [authorization_policies][crate::model::ListAuthorizationPoliciesResponse::authorization_policies].
    pub fn set_authorization_policies<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::AuthorizationPolicy>,
    {
        use std::iter::Iterator;
        self.authorization_policies = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListAuthorizationPoliciesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListAuthorizationPoliciesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ListAuthorizationPoliciesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListAuthorizationPoliciesResponse {
    type PageItem = crate::model::AuthorizationPolicy;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.authorization_policies
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the GetAuthorizationPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetAuthorizationPolicyRequest {
    /// Required. A name of the AuthorizationPolicy to get. Must be in the format
    /// `projects/{project}/locations/{location}/authorizationPolicies/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetAuthorizationPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetAuthorizationPolicyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetAuthorizationPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest"
    }
}

/// Request used by the CreateAuthorizationPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateAuthorizationPolicyRequest {
    /// Required. The parent resource of the AuthorizationPolicy. Must be in the
    /// format `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// Required. Short name of the AuthorizationPolicy resource to be created.
    /// This value should be 1-63 characters long, containing only
    /// letters, numbers, hyphens, and underscores, and should not start
    /// with a number. E.g. "authz_policy".
    pub authorization_policy_id: std::string::String,

    /// Required. AuthorizationPolicy resource to be created.
    pub authorization_policy: std::option::Option<crate::model::AuthorizationPolicy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateAuthorizationPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateAuthorizationPolicyRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [authorization_policy_id][crate::model::CreateAuthorizationPolicyRequest::authorization_policy_id].
    pub fn set_authorization_policy_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.authorization_policy_id = v.into();
        self
    }

    /// Sets the value of [authorization_policy][crate::model::CreateAuthorizationPolicyRequest::authorization_policy].
    pub fn set_authorization_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::AuthorizationPolicy>,
    {
        self.authorization_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [authorization_policy][crate::model::CreateAuthorizationPolicyRequest::authorization_policy].
    pub fn set_or_clear_authorization_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::AuthorizationPolicy>,
    {
        self.authorization_policy = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateAuthorizationPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest"
    }
}

/// Request used by the UpdateAuthorizationPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateAuthorizationPolicyRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// AuthorizationPolicy resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated AuthorizationPolicy resource.
    pub authorization_policy: std::option::Option<crate::model::AuthorizationPolicy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateAuthorizationPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateAuthorizationPolicyRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateAuthorizationPolicyRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [authorization_policy][crate::model::UpdateAuthorizationPolicyRequest::authorization_policy].
    pub fn set_authorization_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::AuthorizationPolicy>,
    {
        self.authorization_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [authorization_policy][crate::model::UpdateAuthorizationPolicyRequest::authorization_policy].
    pub fn set_or_clear_authorization_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::AuthorizationPolicy>,
    {
        self.authorization_policy = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateAuthorizationPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest"
    }
}

/// Request used by the DeleteAuthorizationPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteAuthorizationPolicyRequest {
    /// Required. A name of the AuthorizationPolicy to delete. Must be in the format
    /// `projects/{project}/locations/{location}/authorizationPolicies/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteAuthorizationPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteAuthorizationPolicyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteAuthorizationPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest"
    }
}

/// ClientTlsPolicy is a resource that specifies how a client should authenticate
/// connections to backends of a service. This resource itself does not affect
/// configuration unless it is attached to a backend service resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ClientTlsPolicy {
    /// Required. Name of the ClientTlsPolicy resource. It matches the pattern
    /// `projects/*/locations/{location}/clientTlsPolicies/{client_tls_policy}`
    pub name: std::string::String,

    /// Optional. Free-text description of the resource.
    pub description: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Set of label tags associated with the resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. Server Name Indication string to present to the server during TLS
    /// handshake. E.g: "secure.example.com".
    pub sni: std::string::String,

    /// Optional. Defines a mechanism to provision client identity (public and private keys)
    /// for peer to peer authentication. The presence of this dictates mTLS.
    pub client_certificate: std::option::Option<crate::model::CertificateProvider>,

    /// Optional. Defines the mechanism to obtain the Certificate Authority certificate to
    /// validate the server certificate. If empty, client does not validate the
    /// server certificate.
    pub server_validation_ca: std::vec::Vec<crate::model::ValidationCA>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ClientTlsPolicy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ClientTlsPolicy::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::ClientTlsPolicy::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::ClientTlsPolicy::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ClientTlsPolicy::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::ClientTlsPolicy::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::ClientTlsPolicy::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::ClientTlsPolicy::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [sni][crate::model::ClientTlsPolicy::sni].
    pub fn set_sni<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.sni = v.into();
        self
    }

    /// Sets the value of [client_certificate][crate::model::ClientTlsPolicy::client_certificate].
    pub fn set_client_certificate<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CertificateProvider>,
    {
        self.client_certificate = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [client_certificate][crate::model::ClientTlsPolicy::client_certificate].
    pub fn set_or_clear_client_certificate<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CertificateProvider>,
    {
        self.client_certificate = v.map(|x| x.into());
        self
    }

    /// Sets the value of [server_validation_ca][crate::model::ClientTlsPolicy::server_validation_ca].
    pub fn set_server_validation_ca<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ValidationCA>,
    {
        use std::iter::Iterator;
        self.server_validation_ca = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ClientTlsPolicy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ClientTlsPolicy"
    }
}

/// Request used by the ListClientTlsPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListClientTlsPoliciesRequest {
    /// Required. The project and location from which the ClientTlsPolicies should
    /// be listed, specified in the format `projects/*/locations/{location}`.
    pub parent: std::string::String,

    /// Maximum number of ClientTlsPolicies to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListClientTlsPoliciesResponse`
    /// Indicates that this is a continuation of a prior
    /// `ListClientTlsPolicies` call, and that the system
    /// should return the next page of data.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListClientTlsPoliciesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListClientTlsPoliciesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListClientTlsPoliciesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListClientTlsPoliciesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListClientTlsPoliciesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest"
    }
}

/// Response returned by the ListClientTlsPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListClientTlsPoliciesResponse {
    /// List of ClientTlsPolicy resources.
    pub client_tls_policies: std::vec::Vec<crate::model::ClientTlsPolicy>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListClientTlsPoliciesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [client_tls_policies][crate::model::ListClientTlsPoliciesResponse::client_tls_policies].
    pub fn set_client_tls_policies<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ClientTlsPolicy>,
    {
        use std::iter::Iterator;
        self.client_tls_policies = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListClientTlsPoliciesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListClientTlsPoliciesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ListClientTlsPoliciesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListClientTlsPoliciesResponse {
    type PageItem = crate::model::ClientTlsPolicy;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.client_tls_policies
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the GetClientTlsPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetClientTlsPolicyRequest {
    /// Required. A name of the ClientTlsPolicy to get. Must be in the format
    /// `projects/*/locations/{location}/clientTlsPolicies/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetClientTlsPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetClientTlsPolicyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetClientTlsPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.GetClientTlsPolicyRequest"
    }
}

/// Request used by the CreateClientTlsPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateClientTlsPolicyRequest {
    /// Required. The parent resource of the ClientTlsPolicy. Must be in
    /// the format `projects/*/locations/{location}`.
    pub parent: std::string::String,

    /// Required. Short name of the ClientTlsPolicy resource to be created. This value should
    /// be 1-63 characters long, containing only letters, numbers, hyphens, and
    /// underscores, and should not start with a number. E.g. "client_mtls_policy".
    pub client_tls_policy_id: std::string::String,

    /// Required. ClientTlsPolicy resource to be created.
    pub client_tls_policy: std::option::Option<crate::model::ClientTlsPolicy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateClientTlsPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateClientTlsPolicyRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [client_tls_policy_id][crate::model::CreateClientTlsPolicyRequest::client_tls_policy_id].
    pub fn set_client_tls_policy_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.client_tls_policy_id = v.into();
        self
    }

    /// Sets the value of [client_tls_policy][crate::model::CreateClientTlsPolicyRequest::client_tls_policy].
    pub fn set_client_tls_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ClientTlsPolicy>,
    {
        self.client_tls_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [client_tls_policy][crate::model::CreateClientTlsPolicyRequest::client_tls_policy].
    pub fn set_or_clear_client_tls_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ClientTlsPolicy>,
    {
        self.client_tls_policy = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateClientTlsPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest"
    }
}

/// Request used by UpdateClientTlsPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateClientTlsPolicyRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// ClientTlsPolicy resource by the update.  The fields
    /// specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the
    /// mask. If the user does not provide a mask then all fields will be
    /// overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated ClientTlsPolicy resource.
    pub client_tls_policy: std::option::Option<crate::model::ClientTlsPolicy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateClientTlsPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateClientTlsPolicyRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateClientTlsPolicyRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [client_tls_policy][crate::model::UpdateClientTlsPolicyRequest::client_tls_policy].
    pub fn set_client_tls_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ClientTlsPolicy>,
    {
        self.client_tls_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [client_tls_policy][crate::model::UpdateClientTlsPolicyRequest::client_tls_policy].
    pub fn set_or_clear_client_tls_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ClientTlsPolicy>,
    {
        self.client_tls_policy = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateClientTlsPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest"
    }
}

/// Request used by the DeleteClientTlsPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteClientTlsPolicyRequest {
    /// Required. A name of the ClientTlsPolicy to delete. Must be in
    /// the format `projects/*/locations/{location}/clientTlsPolicies/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteClientTlsPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteClientTlsPolicyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteClientTlsPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest"
    }
}

/// Represents the metadata of the long-running operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have successfully been cancelled
    /// have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
    /// corresponding to `Code.CANCELLED`.
    ///
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.OperationMetadata"
    }
}

/// ServerTlsPolicy is a resource that specifies how a server should authenticate
/// incoming requests. This resource itself does not affect configuration unless
/// it is attached to a target https proxy or endpoint config selector resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServerTlsPolicy {
    /// Required. Name of the ServerTlsPolicy resource. It matches the pattern
    /// `projects/*/locations/{location}/serverTlsPolicies/{server_tls_policy}`
    pub name: std::string::String,

    /// Free-text description of the resource.
    pub description: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Set of label tags associated with the resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Determines if server allows plaintext connections. If set to true, server
    /// allows plain text connections. By default, it is set to false. This setting
    /// is not exclusive of other encryption modes. For example, if `allow_open`
    /// and `mtls_policy` are set, server allows both plain text and mTLS
    /// connections. See documentation of other encryption modes to confirm
    /// compatibility.
    ///
    /// Consider using it if you wish to upgrade in place your deployment to TLS
    /// while having mixed TLS and non-TLS traffic reaching port :80.
    pub allow_open: bool,

    /// Defines a mechanism to provision server identity (public and private keys).
    /// Cannot be combined with `allow_open` as a permissive mode that allows both
    /// plain text and TLS is not supported.
    pub server_certificate: std::option::Option<crate::model::CertificateProvider>,

    /// Defines a mechanism to provision peer validation certificates for peer to
    /// peer authentication (Mutual TLS - mTLS). If not specified, client
    /// certificate will not be requested. The connection is treated as TLS and not
    /// mTLS. If `allow_open` and `mtls_policy` are set, server allows both plain
    /// text and mTLS connections.
    pub mtls_policy: std::option::Option<crate::model::server_tls_policy::MTLSPolicy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ServerTlsPolicy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ServerTlsPolicy::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::ServerTlsPolicy::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::ServerTlsPolicy::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ServerTlsPolicy::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::ServerTlsPolicy::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::ServerTlsPolicy::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::ServerTlsPolicy::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [allow_open][crate::model::ServerTlsPolicy::allow_open].
    pub fn set_allow_open<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.allow_open = v.into();
        self
    }

    /// Sets the value of [server_certificate][crate::model::ServerTlsPolicy::server_certificate].
    pub fn set_server_certificate<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CertificateProvider>,
    {
        self.server_certificate = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [server_certificate][crate::model::ServerTlsPolicy::server_certificate].
    pub fn set_or_clear_server_certificate<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CertificateProvider>,
    {
        self.server_certificate = v.map(|x| x.into());
        self
    }

    /// Sets the value of [mtls_policy][crate::model::ServerTlsPolicy::mtls_policy].
    pub fn set_mtls_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::server_tls_policy::MTLSPolicy>,
    {
        self.mtls_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [mtls_policy][crate::model::ServerTlsPolicy::mtls_policy].
    pub fn set_or_clear_mtls_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::server_tls_policy::MTLSPolicy>,
    {
        self.mtls_policy = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ServerTlsPolicy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ServerTlsPolicy"
    }
}

/// Defines additional types related to [ServerTlsPolicy].
pub mod server_tls_policy {
    #[allow(unused_imports)]
    use super::*;

    /// Specification of the MTLSPolicy.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct MTLSPolicy {
        /// Defines the mechanism to obtain the Certificate Authority certificate to
        /// validate the client certificate.
        pub client_validation_ca: std::vec::Vec<crate::model::ValidationCA>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl MTLSPolicy {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [client_validation_ca][crate::model::server_tls_policy::MTLSPolicy::client_validation_ca].
        pub fn set_client_validation_ca<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::ValidationCA>,
        {
            use std::iter::Iterator;
            self.client_validation_ca = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for MTLSPolicy {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networksecurity.v1.ServerTlsPolicy.MTLSPolicy"
        }
    }
}

/// Request used by the ListServerTlsPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServerTlsPoliciesRequest {
    /// Required. The project and location from which the ServerTlsPolicies should
    /// be listed, specified in the format `projects/*/locations/{location}`.
    pub parent: std::string::String,

    /// Maximum number of ServerTlsPolicies to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListServerTlsPoliciesResponse`
    /// Indicates that this is a continuation of a prior
    /// `ListServerTlsPolicies` call, and that the system
    /// should return the next page of data.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListServerTlsPoliciesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListServerTlsPoliciesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListServerTlsPoliciesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListServerTlsPoliciesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListServerTlsPoliciesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest"
    }
}

/// Response returned by the ListServerTlsPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServerTlsPoliciesResponse {
    /// List of ServerTlsPolicy resources.
    pub server_tls_policies: std::vec::Vec<crate::model::ServerTlsPolicy>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListServerTlsPoliciesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [server_tls_policies][crate::model::ListServerTlsPoliciesResponse::server_tls_policies].
    pub fn set_server_tls_policies<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ServerTlsPolicy>,
    {
        use std::iter::Iterator;
        self.server_tls_policies = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListServerTlsPoliciesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListServerTlsPoliciesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ListServerTlsPoliciesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListServerTlsPoliciesResponse {
    type PageItem = crate::model::ServerTlsPolicy;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.server_tls_policies
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the GetServerTlsPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetServerTlsPolicyRequest {
    /// Required. A name of the ServerTlsPolicy to get. Must be in the format
    /// `projects/*/locations/{location}/serverTlsPolicies/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetServerTlsPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetServerTlsPolicyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetServerTlsPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.GetServerTlsPolicyRequest"
    }
}

/// Request used by the CreateServerTlsPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateServerTlsPolicyRequest {
    /// Required. The parent resource of the ServerTlsPolicy. Must be in
    /// the format `projects/*/locations/{location}`.
    pub parent: std::string::String,

    /// Required. Short name of the ServerTlsPolicy resource to be created. This value should
    /// be 1-63 characters long, containing only letters, numbers, hyphens, and
    /// underscores, and should not start with a number. E.g. "server_mtls_policy".
    pub server_tls_policy_id: std::string::String,

    /// Required. ServerTlsPolicy resource to be created.
    pub server_tls_policy: std::option::Option<crate::model::ServerTlsPolicy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateServerTlsPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateServerTlsPolicyRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [server_tls_policy_id][crate::model::CreateServerTlsPolicyRequest::server_tls_policy_id].
    pub fn set_server_tls_policy_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.server_tls_policy_id = v.into();
        self
    }

    /// Sets the value of [server_tls_policy][crate::model::CreateServerTlsPolicyRequest::server_tls_policy].
    pub fn set_server_tls_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ServerTlsPolicy>,
    {
        self.server_tls_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [server_tls_policy][crate::model::CreateServerTlsPolicyRequest::server_tls_policy].
    pub fn set_or_clear_server_tls_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ServerTlsPolicy>,
    {
        self.server_tls_policy = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateServerTlsPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest"
    }
}

/// Request used by UpdateServerTlsPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateServerTlsPolicyRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// ServerTlsPolicy resource by the update.  The fields
    /// specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the
    /// mask. If the user does not provide a mask then all fields will be
    /// overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated ServerTlsPolicy resource.
    pub server_tls_policy: std::option::Option<crate::model::ServerTlsPolicy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateServerTlsPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateServerTlsPolicyRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateServerTlsPolicyRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [server_tls_policy][crate::model::UpdateServerTlsPolicyRequest::server_tls_policy].
    pub fn set_server_tls_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ServerTlsPolicy>,
    {
        self.server_tls_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [server_tls_policy][crate::model::UpdateServerTlsPolicyRequest::server_tls_policy].
    pub fn set_or_clear_server_tls_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ServerTlsPolicy>,
    {
        self.server_tls_policy = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateServerTlsPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest"
    }
}

/// Request used by the DeleteServerTlsPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteServerTlsPolicyRequest {
    /// Required. A name of the ServerTlsPolicy to delete. Must be in
    /// the format `projects/*/locations/{location}/serverTlsPolicies/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteServerTlsPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteServerTlsPolicyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteServerTlsPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest"
    }
}

/// Specification of the GRPC Endpoint.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GrpcEndpoint {
    /// Required. The target URI of the gRPC endpoint. Only UDS path is supported, and
    /// should start with "unix:".
    pub target_uri: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GrpcEndpoint {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [target_uri][crate::model::GrpcEndpoint::target_uri].
    pub fn set_target_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target_uri = v.into();
        self
    }
}

impl wkt::message::Message for GrpcEndpoint {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.GrpcEndpoint"
    }
}

/// Specification of ValidationCA. Defines the mechanism to obtain the
/// Certificate Authority certificate to validate the peer certificate.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ValidationCA {
    /// The type of certificate provider which provides the CA certificate.
    pub r#type: std::option::Option<crate::model::validation_ca::Type>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ValidationCA {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [r#type][crate::model::ValidationCA::type].
    ///
    /// Note that all the setters affecting `r#type` are mutually
    /// exclusive.
    pub fn set_type<
        T: std::convert::Into<std::option::Option<crate::model::validation_ca::Type>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.r#type = v.into();
        self
    }

    /// The value of [r#type][crate::model::ValidationCA::r#type]
    /// if it holds a `GrpcEndpoint`, `None` if the field is not set or
    /// holds a different branch.
    pub fn grpc_endpoint(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::GrpcEndpoint>> {
        #[allow(unreachable_patterns)]
        self.r#type.as_ref().and_then(|v| match v {
            crate::model::validation_ca::Type::GrpcEndpoint(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [r#type][crate::model::ValidationCA::r#type]
    /// to hold a `GrpcEndpoint`.
    ///
    /// Note that all the setters affecting `r#type` are
    /// mutually exclusive.
    pub fn set_grpc_endpoint<T: std::convert::Into<std::boxed::Box<crate::model::GrpcEndpoint>>>(
        mut self,
        v: T,
    ) -> Self {
        self.r#type =
            std::option::Option::Some(crate::model::validation_ca::Type::GrpcEndpoint(v.into()));
        self
    }

    /// The value of [r#type][crate::model::ValidationCA::r#type]
    /// if it holds a `CertificateProviderInstance`, `None` if the field is not set or
    /// holds a different branch.
    pub fn certificate_provider_instance(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::CertificateProviderInstance>> {
        #[allow(unreachable_patterns)]
        self.r#type.as_ref().and_then(|v| match v {
            crate::model::validation_ca::Type::CertificateProviderInstance(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [r#type][crate::model::ValidationCA::r#type]
    /// to hold a `CertificateProviderInstance`.
    ///
    /// Note that all the setters affecting `r#type` are
    /// mutually exclusive.
    pub fn set_certificate_provider_instance<
        T: std::convert::Into<std::boxed::Box<crate::model::CertificateProviderInstance>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.r#type = std::option::Option::Some(
            crate::model::validation_ca::Type::CertificateProviderInstance(v.into()),
        );
        self
    }
}

impl wkt::message::Message for ValidationCA {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.ValidationCA"
    }
}

/// Defines additional types related to [ValidationCA].
pub mod validation_ca {
    #[allow(unused_imports)]
    use super::*;

    /// The type of certificate provider which provides the CA certificate.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Type {
        /// gRPC specific configuration to access the gRPC server to
        /// obtain the CA certificate.
        GrpcEndpoint(std::boxed::Box<crate::model::GrpcEndpoint>),
        /// The certificate provider instance specification that will be passed to
        /// the data plane, which will be used to load necessary credential
        /// information.
        CertificateProviderInstance(std::boxed::Box<crate::model::CertificateProviderInstance>),
    }
}

/// Specification of a TLS certificate provider instance. Workloads may have one
/// or more CertificateProvider instances (plugins) and one of them is enabled
/// and configured by specifying this message. Workloads use the values from this
/// message to locate and load the CertificateProvider instance configuration.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CertificateProviderInstance {
    /// Required. Plugin instance name, used to locate and load CertificateProvider instance
    /// configuration. Set to "google_cloud_private_spiffe" to use Certificate
    /// Authority Service certificate provider instance.
    pub plugin_instance: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CertificateProviderInstance {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [plugin_instance][crate::model::CertificateProviderInstance::plugin_instance].
    pub fn set_plugin_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.plugin_instance = v.into();
        self
    }
}

impl wkt::message::Message for CertificateProviderInstance {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.CertificateProviderInstance"
    }
}

/// Specification of certificate provider. Defines the mechanism to obtain the
/// certificate and private key for peer to peer authentication.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CertificateProvider {
    /// The type of certificate provider which provides the certificates and
    /// private keys.
    pub r#type: std::option::Option<crate::model::certificate_provider::Type>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CertificateProvider {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [r#type][crate::model::CertificateProvider::type].
    ///
    /// Note that all the setters affecting `r#type` are mutually
    /// exclusive.
    pub fn set_type<
        T: std::convert::Into<std::option::Option<crate::model::certificate_provider::Type>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.r#type = v.into();
        self
    }

    /// The value of [r#type][crate::model::CertificateProvider::r#type]
    /// if it holds a `GrpcEndpoint`, `None` if the field is not set or
    /// holds a different branch.
    pub fn grpc_endpoint(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::GrpcEndpoint>> {
        #[allow(unreachable_patterns)]
        self.r#type.as_ref().and_then(|v| match v {
            crate::model::certificate_provider::Type::GrpcEndpoint(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [r#type][crate::model::CertificateProvider::r#type]
    /// to hold a `GrpcEndpoint`.
    ///
    /// Note that all the setters affecting `r#type` are
    /// mutually exclusive.
    pub fn set_grpc_endpoint<T: std::convert::Into<std::boxed::Box<crate::model::GrpcEndpoint>>>(
        mut self,
        v: T,
    ) -> Self {
        self.r#type = std::option::Option::Some(
            crate::model::certificate_provider::Type::GrpcEndpoint(v.into()),
        );
        self
    }

    /// The value of [r#type][crate::model::CertificateProvider::r#type]
    /// if it holds a `CertificateProviderInstance`, `None` if the field is not set or
    /// holds a different branch.
    pub fn certificate_provider_instance(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::CertificateProviderInstance>> {
        #[allow(unreachable_patterns)]
        self.r#type.as_ref().and_then(|v| match v {
            crate::model::certificate_provider::Type::CertificateProviderInstance(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [r#type][crate::model::CertificateProvider::r#type]
    /// to hold a `CertificateProviderInstance`.
    ///
    /// Note that all the setters affecting `r#type` are
    /// mutually exclusive.
    pub fn set_certificate_provider_instance<
        T: std::convert::Into<std::boxed::Box<crate::model::CertificateProviderInstance>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.r#type = std::option::Option::Some(
            crate::model::certificate_provider::Type::CertificateProviderInstance(v.into()),
        );
        self
    }
}

impl wkt::message::Message for CertificateProvider {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networksecurity.v1.CertificateProvider"
    }
}

/// Defines additional types related to [CertificateProvider].
pub mod certificate_provider {
    #[allow(unused_imports)]
    use super::*;

    /// The type of certificate provider which provides the certificates and
    /// private keys.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Type {
        /// gRPC specific configuration to access the gRPC server to
        /// obtain the cert and private key.
        GrpcEndpoint(std::boxed::Box<crate::model::GrpcEndpoint>),
        /// The certificate provider instance specification that will be passed to
        /// the data plane, which will be used to load necessary credential
        /// information.
        CertificateProviderInstance(std::boxed::Box<crate::model::CertificateProviderInstance>),
    }
}
